package com.liuyi.netty.mqtt.common.util;


import io.netty.handler.codec.mqtt.*;

public class MqttMessageUtil {

    public static MqttConnAckMessage getConnAckMessage(MqttConnectReturnCode connectReturnCode, boolean sessionPresent) {
        MqttFixedHeader mqttFixedHeader = new MqttFixedHeader(MqttMessageType.CONNACK, false, MqttQoS.AT_MOST_ONCE, false, 0);
        MqttConnAckVariableHeader variableHeader = new MqttConnAckVariableHeader(connectReturnCode, sessionPresent);
        return new MqttConnAckMessage(mqttFixedHeader, variableHeader);
    }

}
